package com.cmfi.domain;

import java.io.Serializable;
import java.time.Instant;
import java.util.Objects;

import lombok.Data;

/**
 * A EnergyRec.
 */
@SuppressWarnings("common-java:DuplicatedBlocks")
@Data
public class EnergyRec implements Serializable {

    private static final long serialVersionUID = 1L;
    
//  确认value值的类型，确认什么时候保存一天的使用电量数值
    
    private Long id;

    private double value;//（目前plc读出的用电量总数）这个不对，应该是每日当时总用电量

    private double lastDay;
    
    private Instant createTime;
   // private Instant date;//取的时候自动生成

    // jhipster-needle-entity-add-field - JHipster will add fields here

    public Long getId() {
        return this.id;
    }

    public EnergyRec id(Long id) {
        this.setId(id);
        return this;
    }

    public void setId(Long id) {
        this.id = id;
    }

//    public Long getUsed() {
//        return this.used;
//    }
//
//    public EnergyRec used(Long used) {
//        this.setUsed(used);
//        return this;
//    }
//
//    public void setUsed(Long used) {
//        this.used = used;
//    }

//    public Instant getDate() {
//        return this.date;
//    }
//
//    public EnergyRec date(Instant date) {
//        this.setDate(date);
//        return this;
//    }
//
//    public void setDate(Instant date) {
//        this.date = date;
//    }

    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here

    @Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		EnergyRec other = (EnergyRec) obj;
		return Objects.equals(createTime, other.createTime) && Objects.equals(id, other.id)
				&& Double.doubleToLongBits(lastDay) == Double.doubleToLongBits(other.lastDay)
				&& Double.doubleToLongBits(value) == Double.doubleToLongBits(other.value);
	}

    @Override
	public int hashCode() {
		return Objects.hash(createTime, id, lastDay, value);
	}

	public double getValue() {
		return value;
	}
	
	public EnergyRec value(double value) {
        this.setValue(value);
        return this;
    }

	public void setValue(double variant) {
		this.value = variant;
	}

	public double getLastDay() {
		return lastDay;
	}

	public void setLastDay(double lastDay) {
		this.lastDay = lastDay;
	}

	public Instant getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Instant createTime) {
		this.createTime = createTime;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	@Override
	public String toString() {
		return "EnergyRec [id=" + id + ", value=" + value + ", lastDay=" + lastDay + ", createTime=" + createTime + "]";
	}
	
}
